import Vue from "vue";
import VueRouter from 'vue-router';
import Home from "@/views/Home.vue";
const PlayList = () => import('@/views/PlayList.vue');
const SongPage = () => import('@/views/SongPage.vue');

Vue.use(VueRouter);

const routers = [
    {
        path: '/',
        name: 'Home',
        component: Home,
    },
    {
        // 动态路由
        path: '/playlist/:id',
        name: 'Playlists',
        component: PlayList,
        props: true,
    },
    {
        path: '/songpage/:id/:title',
        name: 'Songpage',
        component: SongPage,
        props: true,
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: routers,
})

export default router;